package com.sh.data.engine.domain.datadev.offline.model.enums;

import java.util.Objects;

/**
 * @Author: zigui.zdf @Date: 2022/2/21 18:02:22 @Description:
 */
public enum OfflineDevJobStatusEnum {
    NO_RUN(1, "未运行"),
    RUNNING(2, "运行中"),
    SUCCESS(3, "成功"),
    FAILURE(4, "失败"),
    CANCEL(5, "停止"),
    PART_FAILED(6, "部分失败"),
    WAITING(7, "等待中"),
    AUTO_INTERRUPT(8, "自动打断"),
    IGNORED(9, "归档");

    int code;

    String name;

    OfflineDevJobStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public static OfflineDevJobStatusEnum of(Integer status) {
        for (OfflineDevJobStatusEnum jobStatusEnum : OfflineDevJobStatusEnum.values()) {
            if (Objects.equals(jobStatusEnum.code, status)) {
                return jobStatusEnum;
            }
        }
        return null;
    }
}
